﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="PrettierDataGridStyle" TargetType="{x:Type DataGrid}">
        <Setter Property="RowStyle">
            <Setter.Value>
                <Style TargetType="{x:Type DataGridRow}">
                    <Style.Triggers>
                        <!-- Highlight a grid row as the mouse passes over -->
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" >
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="#FFFEFBF4" Offset="0"/>
                                        <GradientStop Color="#FFFDE7CE" Offset="0.19"/>
                                        <GradientStop Color="#FFFDDEB8" Offset="0.39"/>
                                        <GradientStop Color="#FFFFCE6B" Offset="0.39"/>
                                        <GradientStop Color="#FFFFDE9A" Offset="0.79"/>
                                        <GradientStop Color="#FFFFEBAA" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>

                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="CellStyle">
            <Setter.Value>
                <Style TargetType="{x:Type DataGridCell}">

                    <!-- Add some padding around the contents of a cell -->
                    <Setter Property="Padding" Value="4,3,4,3" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type DataGridCell}">
                                <Border Padding="{TemplateBinding Padding}"
                                Background="{TemplateBinding Background}">
                                    <ContentPresenter />
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <!-- Highlight selected rows -->
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="Lavender" />
                            <Setter Property="BorderBrush" Value="Lavender" />
                            <Setter Property="Foreground" Value="Black" />
                        </Trigger>
                    </Style.Triggers>

                </Style>
            </Setter.Value>
        </Setter>
        
    </Style>
    <Style TargetType="{x:Type DataGridColumnHeader}"
              xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
        <Style.Resources>
            <Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
                <Setter Property="Width" Value="8"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Cursor" Value="SizeWE"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Thumb}">
                            <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <LinearGradientBrush x:Key="normalBrush" StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FFF2F2F2" Offset="0" />
                    <GradientStop Color="#FFEFEFEF" Offset="0.4" />
                    <GradientStop Color="#FFE7E8EA" Offset="0.4" />
                    <GradientStop Color="#FFDEDFE1" Offset="1" />
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="pressedBrush" StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FF7A9EB1" Offset="0" />
                    <GradientStop Color="#FF7A9EB1" Offset="0.4" />
                    <GradientStop Color="#FF5091AF" Offset="0.4" />
                    <GradientStop Color="#FF4D8DAD" Offset="1" />
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="hoveredBrush" StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FF88CBEB" Offset="0" />
                    <GradientStop Color="#FF88CBEB" Offset="0.4" />
                    <GradientStop Color="#FF69BBE3" Offset="0.4" />
                    <GradientStop Color="#FF69BBE3" Offset="1" />
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
            <SolidColorBrush x:Key="sortedBrush" Color="#FF96D9F9"/>
        </Style.Resources>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Border x:Name="separatorLeft" Grid.Column="0" Width="1" HorizontalAlignment="Left"
                                    Background="{StaticResource normalBrush}">
                            <Border.RenderTransform>
                                <TranslateTransform X="-1"/>
                            </Border.RenderTransform>
                        </Border>
                        <Microsoft_Windows_Themes:DataGridHeaderBorder x:Name="headerBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" IsClickable="{TemplateBinding CanUserSort}" IsPressed="{TemplateBinding IsPressed}" IsHovered="{TemplateBinding IsMouseOver}" Padding="{TemplateBinding Padding}" SortDirection="{TemplateBinding SortDirection}" SeparatorBrush="{TemplateBinding SeparatorBrush}"
                                                                            SeparatorVisibility="Collapsed">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Microsoft_Windows_Themes:DataGridHeaderBorder>
                        <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource ColumnHeaderGripperStyle}"/>
                        <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource ColumnHeaderGripperStyle}"/>
                        <Border x:Name="separatorRight" Grid.Column="1" Width="1" Background="{StaticResource normalBrush}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="separatorRight" Property="Background" Value="{StaticResource pressedBrush}"/>
                            <Setter TargetName="separatorLeft" Property="Background" Value="{StaticResource pressedBrush}"/>
                            <Setter Property="Panel.ZIndex" Value="2"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="separatorRight" Property="Background" Value="{StaticResource hoveredBrush}"/>
                            <Setter TargetName="separatorLeft" Property="Background" Value="{StaticResource hoveredBrush}"/>
                            <Setter Property="Panel.ZIndex" Value="2"/>
                        </Trigger>
                        <Trigger Property="SortDirection" Value="Ascending">
                            <Setter TargetName="separatorRight" Property="Background" Value="{StaticResource sortedBrush}"/>
                            <Setter TargetName="separatorLeft" Property="Background" Value="{StaticResource sortedBrush}"/>
                            <Setter Property="Panel.ZIndex" Value="2"/>
                        </Trigger>
                        <Trigger Property="SortDirection" Value="Descending">
                            <Setter TargetName="separatorRight" Property="Background" Value="{StaticResource sortedBrush}"/>
                            <Setter TargetName="separatorLeft" Property="Background" Value="{StaticResource sortedBrush}"/>
                            <Setter Property="Panel.ZIndex" Value="2"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>